<?php

/* 
 * Manager/DocxManager.php
 */

namespace RHX\Model\Manager;

use RHX\Helper\Docx\Docx;
use Zend\Db\Adapter\Adapter;

class DocxManager{
    protected $adapter = null;
    protected $rootDir;
    /**
     * Constructeur
     * 
     * @param \Zend\Db\Adapter\Adapter $adapter
     */
    public function __construct(Adapter $adapter, $root = '/public/docx/'){
	$this->adapter = $adapter;
	$this->rootDir = $root;
    }
    
    /**
     * Adapteur de base de données
     * 
     * @return Adapter
     */
    public function getAdapter(){
	return $this->adapter;
    }
    
    /**
     * Exportation en DOCX
     * 
     * @param type $matricule
     */
    public function export($matricule){
	$employe = $this->getEmploye($matricule);
	$docx = new Docx($this->rootDir);
	$docx->helloworld('helloworld.docx', "What up Gangsta");
    }
    
    /**
     * Récupérer un employé
     * 
     * @param int $matricule
     * @return \RHX\Model\Object\Employe
     */
    public function getEmploye($matricule){
	$employeManager = new EmployeManager($this->getAdapter());
	return $employeManager->getEmploye($matricule);
    }
}

